Gmail expects a Unix-style mail message on standard input. It uses the sender of the message (as determined from the From line) to determine whether the user is authorized to manipulate Gopher data and, if so, the directory where their operations are to take place.
An authorized user can submit an item to Gopher by mailing it to gmail with the title on the Subject line and the data itself in the body of the message. Gmail will map its title into a well-formed Unix filename (with no special characters to confuse the shell) and copy the data into that file. It will also create an associated .cap file to allow gopherd(8) to map the filename back to the title. If the file already exists, gmail will overwrite it.
If the first word of the subject is delete (or DELETE or some mixed-case equivalent), gmail will generate a filename from the rest of the Subject line and delete it (as well as the associated ``.cap'' file).
Gmail performs some stylistic checking: Gopher data submitted via gmail must consist entirely of printable ASCII characters and no lines in the message body may be over 80 characters long.
When gmail puts submitted data into a file in the Gopher data tree, it inserts the title as the first line of the file (this should make it easier to index data submitted by gmail using WAIS or some other full-text index software). Gmail also appends a byline in the form:
[Submitted by: Mojo Nixon (mojo@foo.edu) Sun, 3 Jan 93 13:00:09 CST]
In calendar mode, gmail will attempt to parse the beginning of the Subject line (after an optional ``delete'' keyword) as a date, force it into a standard form, and use that together with the rest of the Subject line as a title. Dates are expected to be in the format yy-mm-dd or yyyy-mm-dd where yy or yyyy is the year, mm is the month and dd is the day. Gmail has a certain amount of flexibility in parsing dates; all of the following examples are equivalent:
93-01-04: Course registration begins 93-1-4 Course registration begins 1993/01/04 (Mon) : Course registration beginsAll of these would be turned into the following Gopher title:
1993-01-04 (Mon): Course registration begins
In order to avoid mail loops, gmail will exit silently if it receives mail from root, postmaster or the mailer-daemon or if the subject line appears to be an error message.
sender's-email-address [calendar] [directory]
If the ``calendar'' keyword is present, the user is authorized to submit calendar events via a gmail process running in calendar mode. If a directory is specified, the user is authorized to submit data to that directory. Only one directory may be specified per user. The format of the file also allows for blank lines and comments beginning with ``#''. Example:
# This is a sample gmailers file. tjones@foo.edu /foo1/gopher-data/policy # directory only nsinatra@bar.edu calendar # calendar only mojo@foo.edu calendar /foo1/gopher-data/policy # both
For example, consider the following /etc/passwd entries for the machine foo.edu:
cwis:*:999:20:CWIS Operator:/foo/cwis:/bin/csh cwis-mail:*:999:20:CWIS Operator:/foo/cwis/cwis-mail:/bin/csh cwis-cal:*:999:20:CWIS Operator:/foo/cwis-cal:/bin/cshIf ~cwis-mail/.forward contains the following (the quotes are necessary):
"| /usr/local/etc/gmail"and ~cwis-cal/.forward contains the following:
"| /usr/local/etc/gmail -c"then authorized users can submit ordinary Gopher items by mailing them to ``cwis-mail@foo.edu'' and submit calendar items by mailing them to ``cwis-cal@foo.edu''.
Accepts a single date in calendar mode but not a range of dates.
Relies on mail to inform administrator of problems; has no logging.
Some code gratefully borrowed from the audit.pl package by Martin Streicher (strike@convex.com).